<?php

  $WorkTable = &$_SQL_TABLE[$GlobPart];
  $WorkTableKeyFieldName = 'code';
  $_FLAGS['NoCheckLangFieldsInTable'] = __TRUE;

  $AdminMenuSelect = array_kv(getTableAsArray($_SQL_TABLE['admin_menu'], 'menu_group', array(), '', 'id,'.$TabFields['am']['title']), $TabFields['am']['title'], 'id');

  $TabFields['aug'] = getFieldNamesWithLangs($WorkTable, array('title'));

  if($_REQUEST['mode'] == $GlobPart)
  {
    $PageTitle = '$language["admin"]["userGroups"]." :: ".$Item["'.$TabFields['aug']['title'].'"];';
  }
  else
  {
  	$PageTitle = '$language["admin"]["userGroups"];';
  	$AloneMode = $GlobPart;
  }

   $ConfLangArr = array(
				'title_' => array(
								'type' => 'input',
								'title' => $language['admin']['name'],
								'useInAddForm' => 'y',
								'addVariable' => $_POST,
								'useInList' => $CONFIG['useInListSort'],
								'inListEdit' => 'list_input',
								'useInListEdit' => 'y',
								'required' => $CONFIG['AdminReqPatAll'],
								'maxlength' => '50',
								));

  $GeneratedLangArr = getAdminConfigArrayWithLangs($ConfLangArr, $LANGS);

  $_SQL_TABLE_FIELDS[$GlobPart] = $GeneratedLangArr + array(

				'code' => array(
								'type' => 'input',
								'title' => $language['admin']['code'],
								'useInAddForm' => 'y',
								'addVariable' => $_POST['code'],
								'useInList' => $CONFIG['useInListSort'],
								'required' => $CONFIG['AdminReqPatSymbols'],
								'editFormOther' => 'disabled',
								'maxlength' => '10',
								'size' => '10',
								'unique' => 'y',
								),

				'active' => array(
								'type' => 'select_link',
								'title' => $language['admin']['status'],
								'formid' => $CONFIG['activeFormName'],
								'addVariable' => $CONFIG['addUserGroupActive'],
								'noUseInEdit' => 'y',
								'useInList' => $CONFIG['useInListSort'],
								'inListEdit' => 'select_link',
								'values' => array(
											'y' => array(
													'title' => $language['admin']['active'],
													'className' => 'active',
													'formFields' => array(
																	'act' => 'status',
																	'varvalue' => 'n',
																	'varname' => 'active',
																	getKeyVarName() => '{$Item.$WorkTableKeyFieldName}',
													),
											),
											'n' => array(
													'title' => $language['admin']['inactive'],
													'className' => 'inactive',
													'formFields' => array(
																	'act' => 'status',
																	'varvalue' => 'y',
																	'varname' => 'active',
																	getKeyVarName() => '{$Item.$WorkTableKeyFieldName}',
													),
											),
								),
				),

				'date' => array(
								'type' => 'value',
								'title' => $language['admin']['date'],
								'addVariable' => 'NOW()',
								'addVarType' => $CONFIG['VarTypeSQLFunction'],
								'useInList' => $CONFIG['useInListSort'],
								'useInListEdit' => 'y',
								),

				'user_group_menu' => array(
								'type' => 'checkboxes',
								'title' => $language['admin']['adminMenu'],
								'listOfRelations' => 'y',
								'useInAddForm' => 'y',
								'addVariable' => $_POST['user_group_menu'],
								'separator' => '<br />',
								'values' => $AdminMenuSelect,
								'selected' => array_kv(getTableAsArray($_SQL_TABLE['admin_menu_user_group'], '', array("user_group = '".$_REQUEST[getKeyVarName()]."'", "active = 'y'")), 'admin_menu'),
								'tableInfo' => array(
  											'name' => $_SQL_TABLE['admin_menu_user_group'],
  											'keyField' => 'user_group',
  											'relatedField' => 'admin_menu',
  											'keyFieldValue' => $_REQUEST[getKeyVarName()],
  								),
				),

  );

  $_SQL_TABLE_EDIT_FORMS[$GlobPart] = array('active');


?>